package com.xuecheng.content.controller;

import com.xuecheng.content.model.dto.CoursePreviewDTO;
import com.xuecheng.content.service.ICourseOpenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 课程公开信息接口
 * @author 勾新杰
 * @version 1.0
 * @date 2025/2/14 20:33
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/open")
@Api(tags = "课程公开查询接口")
public class CourseOpenController {

    /**
     * 课程公开查询接口
     */
    private final ICourseOpenService courseOpenService;

    /**
     * 根据课程id查询课程信息
     * @param courseId 课程id
     * @return 课程信息
     */
    @GetMapping("/course/whole/{courseId}")
    @ApiOperation("根据课程id查询课程详情，包括课程基本信息、课程营销信息、课程计划、课程教师")
    public CoursePreviewDTO getPreviewInfo(@PathVariable("courseId") Long courseId) {
        return courseOpenService.getCoursePreviewInfo(courseId);
    }
}
